<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <nav-bar></nav-bar>

        <hr>
        <nav-bar></nav-bar>

        <hr>
        <nav-bar></nav-bar>

    </div>

    <!-- 模板内容 -->
    <template id="hello">
        <div>
            <p>{{ msg }}</p>
            <h2>{{ name }}</h2>
            <div>哈哈</div>
            <button @click="name='李四'">修改</button>
        </div>
    </template>

    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                
            },
            components: {
                NavBar: {
                    template: '#hello',
                    data(){ // 组件内部数据是以函数返回值的的形式返回的
                        var obj = {
                            msg: 'welcome',
                            name: '张三'
                        }
                        return obj 
                    }
                }
            }
        })
    </script>
</body>
</html>